package cn.ruituo.adv4.exe;

import java.text.*;
import java.util.*;

public class Birthday {
    public static void main(String[] args) {
    //MM-dd
        //String []ar=s.split("-");
        //
        //Integer.parseInt()
        Scanner input = new Scanner(System.in);
        System.out.println("输入出生月份：");
        int month = input.nextInt();
        System.out.println("输入出生日期：");
        int day = input.nextInt();
        //验证month和day的合法性
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        Calendar now = Calendar.getInstance();
        c.set(Calendar.DAY_OF_MONTH, day);
        if (month < now.get(Calendar.MONTH))
            c.add(Calendar.YEAR, 1);
        c.set(Calendar.MONTH, month - 1);
        while (c.get(Calendar.DAY_OF_MONTH) != day) {
            c.add(Calendar.YEAR, 1);
            c.set(Calendar.DAY_OF_MONTH, day);
            c.set(Calendar.MONTH, month - 1);
        }
        long days = (c.getTimeInMillis() - now.getTimeInMillis()) / 1000 / 3600 / 24;
        System.out.println(days);
    }
}
